cmake_minimum_required(VERSION 3.2)
project(osm-parse)

set(CMAKE_CXX_STANDARD 11)

set(CMAKE_CXX_COMPILE_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -fopenmp")

#>>> MPI
find_package(MPI REQUIRED)
if (MPI_FOUND)
  set(CMAKE_CXX_COMPILER mpicxx)
  set(CMAKE_C_COMPILER mpicc)
  set(CMAKE_CXX_COMPILE_FLAGS "${CMAKE_CXX_COMPILE_FLAGS} ${MPI_COMPILE_FLAGS}")
  set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} ${MPI_LINK_FLAGS}")
  include_directories(SYSTEM ${MPI_INCLUDE_PATH})
  add_definitions(-DUSE_MPI=1)
  set(USE_MPI TRUE)
endif()
#<<< MPI


find_package(HDF5 REQUIRED)
include_directories(${HDF5_INCLUDE_DIR})
message(STATUS "HDF5: -I${HDF5_INCLUDE_DIR} -L${HDF5_LIBRARIES}")

add_executable(osm_parse src/osm_parse.cc)
add_executable(osm_parse_mpi src/osm_parse_mpi.cc)
add_executable(osm_gpx src/osm_gpx.cc)

add_executable(gen_hdf5 src/gen_hdf5.cc)
target_link_libraries(gen_hdf5 ${HDF5_LIBRARIES})